package com.cyp.blogsystem.controller;

import com.cyp.blogsystem.model.request.CreateArticleRequest;
import com.cyp.blogsystem.model.request.UpdateArticleRequest;
import com.cyp.blogsystem.pojo.Result;
import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;

@RestController
@RequestMapping("/api/v1/articles")
@RequiredArgsConstructor
public class ArticleController {

    /**
     * 发布文章
     */
    @PostMapping
    public Result<?> createArticle(@RequestBody CreateArticleRequest request) {
        // TODO: 实现发布文章逻辑
        return Result.success(null);
    }

    /**
     * 获取文章列表
     */
    @GetMapping
    public Result<?> getArticleList(@RequestParam(defaultValue = "1") Integer page,
                                  @RequestParam(defaultValue = "10") Integer size,
                                  @RequestParam(required = false) Long categoryId) {
        // TODO: 实现获取文章列表逻辑
        return Result.success(null);
    }

    /**
     * 获取文章详情
     */
    @GetMapping("/{id}")
    public Result<?> getArticleDetail(@PathVariable Long id) {
        // TODO: 实现获取文章详情逻辑
        return Result.success(null);
    }

    /**
     * 更新文章
     */
    @PutMapping("/{id}")
    public Result<?> updateArticle(@PathVariable Long id, @RequestBody UpdateArticleRequest request) {
        // TODO: 实现更新文章逻辑
        return Result.success(null);
    }

    /**
     * 删除文章
     */
    @DeleteMapping("/{id}")
    public Result<?> deleteArticle(@PathVariable Long id) {
        // TODO: 实现删除文章逻辑
        return Result.success(null);
    }

    /**
     * 点赞/取消点赞
     */
    @PostMapping("/{id}/like")
    public Result<?> likeArticle(@PathVariable Long id) {
        // TODO: 实现点赞/取消点赞逻辑
        return Result.success(null);
    }
}